<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link href="assets/css/bootstrap.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="css/style.css"/>
    <link href="assets/css/codemirror.css" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/colorbox.css">
    <!--图片相册11122244441-->
    <link rel="stylesheet" href="assets/css/ace.min.css"/>

    <link rel="stylesheet" href="font/css/font-awesome.min.css"/>
    <!--[if lte IE 8]>
    <link rel="stylesheet" href="assets/css/ace-ie.min.css"/>
    <![endif]-->
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="assets/js/jquery.colorbox-min.js"></script>
    <script src="assets/js/typeahead-bs2.min.js"></script>
    <script src="assets/js/jquery.dataTables.min.js"></script>
    <script src="assets/js/jquery.dataTables.bootstrap.js"></script>
    <script src="assets/layer/layer.js" type="text/javascript"></script>
    <script src="js/cupload.js"></script>
    <script src="js/myRoute.js"></script>

    <!-- 图片插件 -->
    <link rel="stylesheet" type="text/css" href="Sortable/FraUpload.css">
    <!-- <script src="Sortable/jquery.min.js?v=2.1.4"></script> -->
    <!-- 图片排序 -->
    <script src="Sortable/Sortable.js"></script>
    <script src="Sortable/MD5.js"></script>
    <script src="Sortable/FraUpload.js"></script>

    <!-- 视频插件 -->
    <link rel="stylesheet" type="text/css" href="css/upload.css">
    <script src="js/plupload.full.min.js"></script>
    <!-- <script src="js/upload.js"></script> -->

    <title>列表</title>
    <style type="text/css">
        .string { color: green; }
         .number { color: darkorange; }
         .boolean { color: blue; }
         .null { color: magenta; }
         .key { color: red; }
         body{
            padding: 1rem;
         }
         pre{
            background-color: #f7f7f9;
            border: 1px solid #e1e1e8;
            padding: 5px 10px;
            margin: 0;
            border-radius: 8px;
            min-height: 20px;
         }
         xmp{
            margin: 0;
            padding: 0;
         }
         #upload_duixiang{
            display: inline-block;
            margin-bottom: 8px;
            margin-left: 10px;
            color: #fff;
            background-color: #337ab7;
            border-color: #2e6da4;
            padding: 5px 10px;
            font-size: 12px;
            line-height: 1.5;
            border-radius: 3px;
            cursor: pointer;
         }
         /*新*/
         .iconfont {
                 font-family: "iconfont" !important;
                 font-size: 14px;
                 font-style: normal;
                 -webkit-font-smoothing: antialiased;
                 -webkit-text-stroke-width: 0.1px;
                 -moz-osx-font-smoothing: grayscale;
             }

             @font-face {
                 font-family: 'iconfont';  /* project id 987132 */
                 src: url('//at.alicdn.com/t/font_987132_huga9t6yr1s.eot');
                 src: url('//at.alicdn.com/t/font_987132_huga9t6yr1s.eot?#iefix') format('embedded-opentype'),
                 url('//at.alicdn.com/t/font_987132_huga9t6yr1s.woff2') format('woff2'),
                 url('//at.alicdn.com/t/font_987132_huga9t6yr1s.woff') format('woff'),
                 url('//at.alicdn.com/t/font_987132_huga9t6yr1s.ttf') format('truetype'),
                 url('//at.alicdn.com/t/font_987132_huga9t6yr1s.svg#iconfont') format('svg');
             }


         .add_div {
             width: 250px;
             height: 150px;
             border: solid #ccc 1px;
             margin-left: 10px;
             padding: 10px 10px 10px 10px;
         }

         .file-list {
             height: auto;
             display: none;
             list-style-type: none;
         }

         .file-list img {
             max-width: 70px;
             vertical-align: middle;
         }

          .file-item {
             /* float: left; */
             border:solid red px;
             margin:5px 10px;
         }
         .add{
           display: inline-block;
           margin-bottom: 8px;
           margin-left: 10px;
           color: #fff;
           background-color: #337ab7;
           border-color: #2e6da4;
           padding: 5px 10px;
           font-size: 12px;
           line-height: 1.5;
           border-radius: 3px;
           cursor: pointer;
         }
         .file-del {
                 float: right;
                 margin-top: -9px;
                 margin-left: -2px;
                 cursor: pointer;
                 font-size: 12px;
                 z-index: 100;
                 position: absolute;
             }
        .color-block{
            width: 20px;
            height: 20px;
            display: block;
            border: 1px solid #fff;
            float: left;
            margin-bottom: 10px;
            margin-right: 10px;
        }
        .color-block2{
            width: 160px;
            padding-left: 10px;
            height: 20px;
            display: block;
            color: #444444;
            background-color: #e2e2e2;
            border: 1px solid #fff;
            float: left;
            margin-bottom: 10px;
            margin-right: 10px;
        }
        .color-txt{
            display:inline-block;
            width: 80px;
            height: 18px;
            border: 0px solid #fff;
        }
    </style>
</head>

<body>
<div class="page-content clearfix">
    <div class="sort_adsadd_style">
       <div class="border clearfix">
       <span class="l_f">
        <a href="javascript:;" id="ads_add" title="添加品牌" class="btn btn-warning Order_form"><i class="fa fa-plus"></i> 添加品牌</a>
        <a href="javascript:;" id="all_del" class="btn btn-danger"><i class="fa fa-trash"></i> 批量删除</a>
        <input type='hidden' id='all_del_no' value=''/>
           <!-- <a href="javascript:ovid()" onClick="javascript :history.back(-1);" class="btn btn-info"><i class="fa fa-reply"></i> 返回上一步</a> -->
       </span>
            <!-- <span class="r_f">共：<b><span id="pageCount">234</span></b>条记录</span> -->
        </div>
        <!--列表样式-->
        <div class="sort_Ads_list">
            <table class="table table-striped table-bordered table-hover" id="sample-table">
                <thead>
                <tr>
                    <th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
                    <th width="50px">ID</th>
                    <th width="50px">楼层</th>
                    <th width="50px">门牌号</th>
                    <th width="70px">门店名称</th>
                    <th width="70px">英文名称</th>
                    <th width="70px">联系电话</th>
                    <th width="70">品牌分类</th>
                    <th width="50">品牌颜色</th>
                    <th width="200">简介文字</th>
                    <th width="70px">logo图片</th>
                    <th width="70px">门店宣传图片</th>
                    <th width="70">排序</th>
                    <th width="70">状态</th>
                    <th width="120">操作</th>
                </tr>
                </thead>
                <tbody id="content">


                </tbody>
            </table>
        </div>

    </div>
</div>
<!--添加广告样式-->
<div id="add_ads_style" style="display:none; top:0px;">
    <div class="add_adverts">
        <ul>
            <li style="height:32px">
                <label class="label_name">楼层</label>
                <span class="cont_style">
                    <select class="form-control" id="image_floor" style="width:100px">

                    </select>
              </span>
            </li>
            <li style="height:32px">
                <label class="label_name">门牌号</label>
                <span class="cont_style">
                  <input name="门牌号" type="text" id="image_number" placeholder="门牌号" class="col-xs-10 col-sm-5" style="width:200px">
              </span>
            </li>
            <li style="height:32px">
                <label class="label_name">门店名称</label>
                <span class="cont_style">
                  <input name="门店名称" type="text" id="image_cname" placeholder="门店名称" class="col-xs-10 col-sm-5" style="width:200px">
              </span>
            </li>
            <li style="height:32px">
                <label class="label_name">英文名称</label>
                <span class="cont_style">
                  <input name="英文名称" type="text" id="image_ename" placeholder="英文名称" class="col-xs-10 col-sm-5" style="width:200px">
              </span>
            </li>
            <li style="height:32px;" >
                <label class="label_name">电话号码</label>
                <span class="cont_style">
                  <input name="电话号码" type="text" id="image_phone" placeholder="电话号码" class="col-xs-10 col-sm-5" style="width:200px">
                </span>
            </li>
            <!-- <li style="height:32px">
                <label class="label_name">品牌分类</label>
                <span class="cont_style">
                  <label style="margin-left:12px;"><input type="checkbox" name="brandtype" value="家具" checked="checked"/> 家具</label>
                  <label><input type="checkbox" name="brandtype" value="建材"/> 建材</label>
                </span>
            </li> -->

            <li style="height:310px">
                <label class="label_name">品牌分类</label>
                <div class="cont_style" style="border:1px solid #d5d5d5; margin-left:10px; width:560px; padding: 10px 10px;">
                    <div style="width: 100%;font-weight: bold; margin-bottom: 10px;">品类名称 > 
                        <span style="color: #ff0000;">当前品类名称：</span>
                        <span style="color: #ff0000;" id="selectValue"></span>
                    </div>
                    <select style="margin-bottom: 5px;" id="select-1">       
                        <option>整体家具</option>
                        <option>整体家具(含进口)</option>
                        <option>进口家具</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-2">
                        <option>儿童家具</option>
                        <option>儿童家具(含进口)</option>
                        <option>儿童进口家具</option>
                        <option>儿童定制家具</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-3">       
                        <option>软装</option>
                        <option>软装(含进口)</option>
                        <option>进口软装</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-4">     
                        <option>软床</option>  
                        <option>软床(含进口)</option>
                        <option>进口软床</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-5">     
                        <option>地板</option>  
                        <option>地板(含进口)</option>
                        <option>进口地板</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-6">    
                        <option>涂料</option>   
                        <option>涂料(含进口)</option>
                        <option>进口涂料</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-7">       
                        <option>沙发</option>
                        <option>沙发(含进口)</option>
                        <option>进口沙发</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-8">      
                        <option>电器</option> 
                        <option>智能电器</option>
                        <option>电器馆</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-9">
                        <option>门窗</option>  
                        <option>系统门窗</option>       
                        <option>系统门窗(含进口)</option>
                        <option>进口门窗</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-10">       
                        <option>现代实木家具</option>
                        <option>新中式家具</option>
                        <option>新中式/现代实木家具</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-11">    
                        <option>全屋定制</option>   
                        <option>高端定制</option>
                        <option>橱柜</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-12">    
                        <option>原创设计家具</option>   
                        <option>原创设计家具</option>   
                    </select>
                    <select style="margin-bottom: 5px;" id="select-13">    
                        <option>户外园艺</option>   
                        <option>户外园艺</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-14">    
                        <option>卫浴</option>  
                        <option>卫浴</option> 
                    </select>
                    <select style="margin-bottom: 5px;" id="select-15">    
                        <option>家装设计</option>   
                        <option>家装设计</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-16">    
                        <option>设计师共享中心</option>   
                        <option>设计师共享中心</option>
                    </select>
                    <select style="margin-bottom: 5px;" id="select-17">    
                        <option>其他</option> 
                        <option>精品灯饰</option>  
                        <option>红木家具</option>
                        <option>凯撒至尊国际馆</option>   
                        <option>瓷砖/石材</option>  
                    </select>

                  <!-- <label style="margin-left:10px;">家具</label></br>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_整体家具" checked='checked'/> 整体家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_凯撒至尊国际馆" /> 凯撒至尊国际馆</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_原创设计家具" /> 原创设计家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_新中式家具" /> 新中式家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_现代实木家具" /> 现代实木家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_儿童家具" /> 儿童家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_红木家具" /> 红木家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_轻奢家具" /> 轻奢家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_欧美家具" /> 欧美家具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_沙发" /> 沙发</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_床垫" /> 床垫</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="家具_其他" /> 其他</label> -->

                </div>
                <div class="cont_style" style="margin-left:90px; border:1px solid #d5d5d5; padding: 10px 10px; width:560px; margin-top:10px;">
                   <div style="width: 100%; font-weight: bold; margin-bottom: 10px;">品类颜色 > 
                    <span style="color: #ff0000;">当前颜色值：</span>
                    <span style="color: #ff0000;" id="colorValue"></span>
                </div>
                   <span id="color-0" class="color-block" style="background-color:#e3b371;"></span> 
                   <span id="color-1" class="color-block" style="background-color:#d3afcb;"></span> 
                   <span id="color-2" class="color-block" style="background-color:#dfb3a8;"></span> 
                   <span id="color-3" class="color-block" style="background-color:#c7d9c9;"></span> 
                   <span id="color-4" class="color-block" style="background-color:#e3d5b2;"></span> 
                   <span id="color-5" class="color-block" style="background-color:#90ad99;"></span> 
                   <span id="color-6" class="color-block" style="background-color:#dd9773;"></span> 
                   <span id="color-7" class="color-block" style="background-color:#9ab554;"></span> 
                   <span id="color-8" class="color-block" style="background-color:#86c0cb;"></span> 
                   <span id="color-9" class="color-block" style="background-color:#a6c5a1;"></span> 
                   <span id="color-10" class="color-block" style="background-color:#e9caac;"></span> 
                   <span id="color-11" class="color-block" style="background-color:#c7a589;"></span> 
                   <span id="color-12" class="color-block" style="background-color:#d49546;"></span> 
                   <span id="color-13" class="color-block" style="background-color:#e8d356;"></span> 
                   <span id="color-14" class="color-block" style="background-color:#e18182;"></span> 
                   <span id="color-15" class="color-block" style="background-color:#7cd9a4;"></span> 
                   <span id="color-16" class="color-block" style="background-color:#669da2;"></span> 
                   <span id="color-17" class="color-block" style="background-color:#a4a5cb;"></span> 
                   <span id="color-18" class="color-block" style="background-color:#3c7dbd;"></span> 
                   <span id="color-19" class="color-block" style="background-color:#bab69d;"></span> 
                   <span id="color-20" class="color-block" style="background-color:#a3c19d;"></span> 
                   <div class="color-block2">#
                    <input name="品类颜色" id="color-id" class="color-txt" type="text" value="" />
                    <span id="color-btn" style="margin-left: 10px;">确定</span>
                   </div>

                  <!-- <label style="margin-left:10px;">建材</label></br>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_全屋定制" /> 全屋定制</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_户外园艺" /> 户外园艺</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_软装" /> 软装</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_橱柜" /> 橱柜</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_门窗" /> 门窗</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_电器" /> 电器</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_灯饰" /> 灯饰</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_洁具" /> 洁具</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_卫浴" /> 卫浴</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_净水" /> 净水</label>
                  <label style="margin-left:10px;"><input type="radio" name="brandtype" value="建材_其他" /> 其他</label> -->
                  </div>
            </li>

            <!-- 去掉了这条 -->
            <!-- <li style="height:32px;display:none;">
                <label class="label_name">标题</label>
                <span class="cont_style">
                  <input name="标题" type="text" id="image_title" placeholder="标题" class="col-xs-10 col-sm-5" style="width:500px">
                </span>
            </li> -->


            <li style="height:32px;margin-top: 10px;">
                <label class="label_name">简介文字</label>
                <span class="cont_style">
                  <input name="简介文字" type="text" id="image_content" placeholder="简介文字" class="col-xs-10 col-sm-5" style="width:560px">
                </span>
            </li>

            <!-- logo上传 -->
            <!-- <li style="display:none;">
                <label class="label_name">logo图片</label>
                <div class="cont_style" style="width:250px">
                  <form enctype="multipart/form-data">
                      <input type="hidden" id="imagepath" name="name">
                      <span id="upload_duixiang">上传logo图片</span>
                      <div class="show"></div>

                  </form>
                </div>
            </li> -->

            <!-- logo上传 -->
            <li>
                <label class="label_name">logo图片</label>
                <div class="cont_style" style="width:250px">
                  <span class="add choose">添加logo图片</span>
                  <div class="add_div">
                    <input type="file" name="" id="choose-file" multiple="multiple" style="opacity: 0;display:none;"/>
                    <input type="hidden" id="logoimagepath">
                    <!--<input type="file" name="" id="choose-file" />-->
                    <ul class="file-list">

                    </ul>
                    <button style="cursor: pointer;margin-left: 10px;" href="javascript:;" id="upload">上传</button>
                  </div>
                </div>
            </li>

            <!-- 门店上传 -->
            <li>
                <label class="label_name">门店图片</label>
                <div class="cont_style" style="width:250px">
                  <form enctype="multipart/form-data">
                      <input type="hidden" id="imagepath"> <!-- 保存的图片id 用于表单提交 -->
                        <span id="upload_duixiang">添加门店图片</span> <!-- 上传按钮 -->
                        <div class="show"></div> <!-- 输出图片 -->
                        <!-- <pre id="geoJsonTxt"></pre> -->
                        <!-- 输出文件的json数据 -->
                  </form>
                </div>
            </li>

            <!-- 上传视频去掉了 -->
        </ul>
    </div>
</div>
</body>
</html>
<script>
    var bannelType = bannelPage_pingpai;
    var selectValue= '';
    var colorValue= '';
    ////////////////////////////////////////////////logo上传//////////////////////////////////////////////
    $(function () {
      $('.choose').click(function(){
          $('#choose-file').click();
      })
      //声明变量
      var $button = $('#upload'),
          //选择文件按钮
          $file = $("#choose-file"),
          //回显的列表
          $list = $('.file-list'),
          //选择要上传的所有文件
          fileList = [];
      //当前选择上传的文件
      var curFile;
      // 选择按钮change事件，实例化fileReader,调它的readAsDataURL并把原生File对象传给它，
      // 监听它的onload事件，load完读取的结果就在它的result属性里了。它是一个base64格式的，可直接赋值给一个img的src.
      $file.on('change', function (e) {
          //上传过图片后再次上传时限值数量
          var numold = $('.file-item').length;
          if(numold >= 1){
              layer.alert('最多上传1张图片');
              return;
          }
          //限制单次批量上传的数量
          var num = e.target.files.length;
          var numall = numold + num;
          if(num >1 ){
             layer.alert('最多上传1张图片');
             return;
          }else if(numall > 1){
              layer.alert('最多上传1张图片');
              return;
          }
          //原生的文件对象，相当于$file.get(0).files;//files[0]为第一张图片的信息;
          curFile = this.files;
          //curFile = $file.get(0).files;
          console.log(curFile);
          //将FileList对象变成数组
          fileList = fileList.concat(Array.from(curFile));
          //console.log(fileList);
          for (var i = 0, len = curFile.length; i < len; i++) {
              reviewFile(curFile[i])
          }
          $('.file-list').fadeIn(2500);
      })

      /*
        选择品牌分类
      */
    //   var selectValue= '';
      $("#select-1,#select-2,#select-3,#select-4,#select-5,#select-6,#select-7,#select-8,#select-9,#select-10,#select-11,#select-12,#select-13,#select-14,#select-15,#select-16,#select-17").change(function(event){
        selectValue = event.target.value;
        console.log(selectValue)
        $("#selectValue").html(selectValue)
      })


      /*
        选择品牌颜色
      */
    //   var colorValue= '';
      var colorArr=['#e3b371','#d3afcb','#dfb3a8','#c7d9c9','#e3d5b2','#90ad99','#dd9773','#9ab554','#86c0cb','#a6c5a1','#e9caac',
                   '#c7a589','#d49546','#e8d356','#e18182','#7cd9a4','#669da2','#a4a5cb','#3c7dbd','#bab69d','#a3c19d'];
      $("#color-0,#color-1,#color-2,#color-3,#color-4,#color-5,#color-6,#color-7,#color-8,#color-9,#color-10,#color-11,#color-12,#color-13,#color-14,#color-15,#color-16,#color-17,#color-18,#color-19,#color-20").click(function(event){
        var str = event.target.id;
        var id = str.split('-')
        var num = id[1];
        colorValue = colorArr[num];
        console.log(colorValue)
        $("#colorValue").html(colorValue)
        $("#color-id").val(colorValue)
      })
      //确定
      $("#color-btn").click(function(event){
        var cv = $("#color-id").val();
        if(cv){
            colorValue= cv;
            console.log(colorValue)
            $("#colorValue").html(colorValue)
        }
      })
      

      function reviewFile(file) {
          //实例化fileReader,
          var fd = new FileReader();
          //获取当前选择文件的类型
          var fileType = file.type;
          //调它的readAsDataURL并把原生File对象传给它，
          fd.readAsDataURL(file);//base64
          //监听它的onload事件，load完读取的结果就在它的result属性里了
          fd.onload = function () {
              if (/^image\/[jpeg|png|jpg|gif]/.test(fileType)) {
                  $list.append('<li class="file-item"><img src="' + this.result + '" alt="" height="70"><span class="file-del"><i class="iconfont ">&#xe636;</i></span></li>').children(':last').hide().fadeIn(2500);
              } else {
                  $list.append('<li class="file-item"><span class="file-name">' + file.name + '</span><span class="file-del"><i class="iconfont ">&#xe636;</i></span></li>')
              }

          }
      }
      //点击删除按钮事件：
      $(".file-list").on('click', '.file-del', function () {
          let $parent = $(this).parent();
          console.log($parent);
          let index = $parent.index();
          fileList.splice(index, 1);
          $parent.fadeOut(850, function () {
              $parent.remove()
          });
          var filess = document.getElementById('choose-file');
          filess.value = '';
      });
      //点击上传按钮事件：
      $button.on('click', function () {
        // console.log("selectValue:"+selectValue,"colorValue:"+colorValue)
          var name = $('#name').val();
          if (name == '') {
              layer.msg('请输入名称');
              return;
          }
           if(fileList.length > 1){
                  layer.alert('最多允许上传6张图片');
                  return;
          } else {
              var formData = new FormData();
              for (var i = 0, len = fileList.length; i < len; i++) {
                  //console.log(fileList[i]);
                  formData.append('upfile[]', fileList[i]);
              }
              formData.append('name', name);
              // formData.append('catgory', catgory);
              // formData.append('price', price);
              // formData.append('desc', desc);
              // formData.append('stock', stock);
              // formData.append('status', status);
              //console.log(formData);
              $.ajax({
                  url: uploadFile1,
                  type: 'post',
                  data: formData,
                  dataType: 'json',
                  processData: false,
                  contentType: false,
                  success: function (data) {
                  //  if( data.code != 200)
                   $("#logoimagepath").val(data.data);

                      // if (data.status == '1') {
                      //     layer.msg(data.content, {icon: 6});
                      // } else if (data.status == '2') {
                      //     layer.msg(data.content, {icon: 1});
                      // }
                  }
              })
          }
      })
    })



    // 商品图片上传a
    a = $("#upload_duixiang").FraUpload({
        view        : ".show",      // 视图输出位置
        url         : uploadFile, // 上传接口
        fetch       : "img",   // 视图现在只支持img
        debug       : false,    // 是否开启调试模式
        /* 外部获得的回调接口 */
        onLoad: function(e){                    // 选择文件的回调方法
            console.log("外部: 初始化完成...");
        },
        breforePort: function (e) {         // 发送前触发
            console.log("文件发送之前触发");
        },
        successPort: function (e) {         // 发送成功触发
            console.log("文件发送成功");
            onload_image()
        },
        errorPort: function (e) {       // 发送失败触发
            console.log("文件发送失败");
            onload_image()
        },
        deletePost: function(e){    // 删除文件触发
            console.log("删除文件");
            console.log(e);
            alert('删除了'+e.filename)
            onload_image()
        },
        sort: function(e){      // 排序触发
            console.log("排序");
            onload_image()
        },
    });

    // 获取图片上传信息a
    function onload_image(){
        var res = a.FraUpload.show();
        var ids = [];
        for(let k in res){
            this_val = res[k]
            if(!empty(res[k]['is_upload']) && !empty(res[k]['ajax'])){
                ajax_value = res[k]['ajax'];
                ids.push(ajax_value.data)
            }
        }
        $("#imagepath").val(ids.join(","));
        $('#geoJsonTxt').html(JsonFormat(res));
    }


    // 将类库返回的json打印到pre中
    function JsonFormat(json) {
        if (typeof json != 'string') {
            json = JSON.stringify(json, undefined, 2);
        }
            json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
            return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
                 var cls = 'number';
                    if (/^"/.test(match)) {
                            if (/:$/.test(match)) {
                                cls = 'key';
                            } else {
                                cls = 'string';
                            }
                    } else if (/true|false/.test(match)) {
                        cls = 'boolean';
                    } else if (/null/.test(match)) {
                        cls = 'null';
                    }
                    return '<span class="' + cls + '">' + match + '</span>';
             });
    }
    /**
     * 判断变量是否为空
     */
    function empty(value) {
        if(value=="" || value==undefined || value==null || value==false || value==[] || value=={}){
            return true;
        }else{
            return false;
        }
    }

    /*用户-停用*/
    function member_stop(obj, id) {
        layer.confirm('确认要停用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs " onClick="member_start(this,id)" href="javascript:;" title="启用"><i class="fa fa-close bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已停用</span>');
            $(obj).remove();
            changeStatus(id)
            layer.msg('已停用!', {icon: 5, time: 1000});
        });
    }

    /*用户-启用*/
    function member_start(obj, id) {
        layer.confirm('确认要启用吗？', function (index) {
            $(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" class="btn btn-xs btn-success" onClick="member_stop(this,id)" href="javascript:;" title="停用"><i class="fa fa-check  bigger-120"></i></a>');
            $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
            $(obj).remove();
            changeStatus(id);
            layer.msg('已启用!', {icon: 6, time: 1000});
        });
    }

    /*产品-编辑*/
    function member_edit(title, url, id, w, h) {
        console.log(title, url, id, w, h)
    }

    /*编辑*/
    function editBrand(title,id){
        console.log(id)
        //每次点击的时候获取所有的楼层
        var data = {};
        data.pageNo = 1;
        data.pageSize = 999;
        data.bannelType = bannelPage_pingpai;
        $.ajax({
            type: 'get',
            dataType: 'json',
            url: UrlbannelPage,
            data: data,
            success: function (res) {
                var data = res.data;
                var content = "";
                // console.log(res.data)
                // for (var i in data) {
                //     content += '<option value="'+data[i].title+'">' + data[i].title + '</option>\n';
                // }
                for(var i in data){
                    if(data[i].id == id){
                        console.log(data[i])
                        var json = JSON.parse(data[i].append)

                        $("#image_floor").html('<option value="'+ json.louceng+'">' + json.louceng + '</option>');
                        $("#image_number").val(json.menpaihao);
                        $("#image_cname").val(json.cname);
                        $("#image_ename").val(json.ename);
                        $("#image_phone").val(json.phone);
                        $("#logoimagepath").val(json.logo);
                        $("#imagepath").val(json.image);
                        $("#selectValue").html(json.brand_type);
                        selectValue = json.brand_type;
                        $("#color-id").val(json.brand_color);
                        $("#colorValue").html(json.brand_color)
                        colorValue = json.brand_color;
                        $("#image_content").val(json.content);
                    }
                }
                // $("#image_floor").append(content);
                
            }
        });


        layer.open({
            type: 1,
            title: '编辑品牌',
            maxmin: true,
            shadeClose: false, //点击遮罩关闭层
            area: ['800px', ''],
            content: $('#add_ads_style'),
            btn: ['提交', '取消'],
            yes: function (index, layero) {
                var num = 0;
                var str = "";
                $(".add_adverts input[type$='text']").each(function (n) {
                    if ($(this).val() == "") {
                        layer.alert(str += "" + $(this).attr("name") + "不能为空！\r\n", {
                            title: '提示框',
                            icon: 0,
                        });
                        num++;
                        return false;
                    }
                });
                if (num > 0) {
                    return false;
                } else {
                    var append = {};
                    append.louceng = $("#image_floor").val();
                    append.menpaihao = $("#image_number").val();
                    append.cname = $("#image_cname").val();
                    append.ename = $("#image_ename").val();
                    append.phone = $("#image_phone").val();
                    // append.shopType = $("#image_type").val();
                    append.content = $("#image_content").val();
                    append.logo = $("#logoimagepath").val();
                    append.image = $("#imagepath").val();
                    append.brand_type  = selectValue;
                    append.brand_color  = colorValue;

                    var data = {};
                    data.id = id;
                    data.bannel_type = bannelType;
                    data.image_type = 2;
                    data.title = $("#image_floor").val();
                    data.content = $("#image_content").val();
                    data.image_url_str = "";
                    data.append = JSON.stringify(append);
                    // data.token = localStorage.token;
                    $.ajax({
                        type: 'post',
                        dataType: 'json',
                        url: UrlbannelEdit+"?token="+localStorage.token,
                        data: data,
                        success: function (res) {
                            if (res.code != 200) {
                                layer.msg(res.message, {icon: 6, time: 1000});
                            }else{
                                layer.alert('修改成功！', {
                                    title: '提示框',
                                    icon: 1,
                                });
                                layer.close(index);
                                location.reload();
                            }
                        }
                    });
                }
            }
        });
    }

    /*产品-删除*/
    function member_del(obj, id) {
      console.log(id);
        layer.confirm('确认要删除吗？', function (index) {
            //分页获取数据
            bannelDel(id);
        });
    }

    /*产品-上移*/
    function member_up(obj, id) {
        exchangeSort(id,1)
    }

    /*产品-下移*/
    function member_down(obj, id) {
        exchangeSort(id,2)
    }


    function layer_show(title, url, w, h) {
        if (title == null || title == '') {
            title = false;
        }
        ;
        if (url == null || url == '') {
            url = "404.html";
        }
        ;
        if (w == null || w == '') {
            w = 800;
        }
        ;
        if (h == null || h == '') {
            h = ($(window).height() - 50);
        }
        ;
        layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false, //不固定
            maxmin: true,
            shade: 0.4,
            title: title,
            content: url
        });
    }


    initPage();

    //初始化这一页的数据
    function initPage() {
        //分页获取数据
        var data = {};
        data.token = localStorage.token;
        data.pageNo = 1;
        data.pageSize = 999;
        data.bannelType = bannelType;
        $.ajax({
            type: 'get',
            dataType: 'json',
            url: UrlbannelPage,
            data: data,
            success: function (res) {
                var content = initContentBrand(res.data);
                $('#content').html(content);
                //分页
                pageList();
                //选择所有
                choiceAllList();
                //选择单个值
                choiceSingleList();
            }
        });
    }

    //分页插件
    function pageList(){
      var oTable1 = $('#sample-table').dataTable( {
      //"aaSorting": [[ 1, "asc" ]],//默认第几个排序
      //"bStateSave": true,//状态保存
      //"searching" : false,
      "order": [[ 10, "asc" ]],
      "aoColumnDefs": [
            //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
            {"orderable":false,"aTargets":[0,1,2,3,4,5,6,7,8,9,10,11,12]}// 制定列不参与排序
        ]
      } );
    }

    /*批量删除*/
    var allNoArr = [];
    $('#all_del').on('click', function () {
        layer.confirm('确认要批量删除吗？', function (index) {
            //$(obj).parents("tr").remove();
            bannelDel(allNoArr.join(","));
        });
    })

    //多选项选择了所有选择项
    function choiceAllList(){
      $('table th input:checkbox').on('click' , function(){
        var that = this;
        $(this).closest('table').find('tr > td:first-child input:checkbox')
        .each(function(){
          //console.log(this.);
          var curHtml = $(this).parent('label').parent('td').siblings()[0];
          $(curHtml).each(function(){
            var val = $(this).text();
            //console.log(val);
            allNoArr.push(val);
            });
          this.checked = that.checked;
          $(this).closest('tr').toggleClass('selected');
        });
        var newArr = unique(allNoArr);
        allNoArr = newArr;
        //console.log("allNoArr:"+allNoArr);
      });
    }
    //多选项选择了单个选择项
    function choiceSingleList(){
      $('#content > tr > td:first-child input:checkbox').on('click' , function(){
        var that = this;
        this.checked = that.checked;
        var dom=$(this);
        //console.log("curArr:"+allNoArr);
        //console.log("status:"+dom.is(':checked'));
        var curHtml = $(this).parent('label').parent('td').siblings()[0];
        $(curHtml).each(function(){
            var val = $(this).text();
            //console.log("cur:"+val);
            if(dom.is(':checked')){//选中，添加到数组后并去重
              allNoArr.push(val);
              var newArr = unique(allNoArr);
              allNoArr = newArr;
              //console.log("add:"+allNoArr);
            }else{
              if(allNoArr.indexOf(val) > -1){ //取消或没选，则查询位置并删除数组中已有数据。
                //console.log("2:"+allNoArr.indexOf(val));
                allNoArr.splice(allNoArr.indexOf(val),1)
                //console.log("del:"+allNoArr);
              }
            }
            //
          });
      });
    }

    //数组去重
    function unique(arr) {
        var obj = {};
        return arr.filter(function(item, index, arr){
            return obj.hasOwnProperty(typeof item + item) ? false : (obj[typeof item + item] = true)
        })
    }


    //取checked值
    function getChecked(){
      var obj = document.getElementsByName("brandtype");
      var check_val = [];
      for(k in obj){
        if(obj[k].checked){
          check_val.push(obj[k].value)
        }
      }
      return check_val;
      //console.log(check_val);
      //
    }


    //
    // var brandtypes = "家具"+","+"整体家具";
    // //家具单选选项
    // $("input[name=jiaju]").click(function(){
    //   var jiaju = $(this).val();
    //   $("input[name=jiancai]").attr("checked",false);
    //   brandtypes = "家具"+","+jiaju;
    //   //alert(jiaju);
    //   console.log(brandtypes);
    // });
    // //建材单选选项
    // $("input[name=jiancai]").click(function(){
    //   var jiancai = $(this).val();
    //   $("input[name=jiaju]").attr("checked",false);
    //   brandtypes = "建材"+","+jiancai;
    //   //alert(jiancai);
    //   console.log(brandtypes);
    // });




    /*******添加广告*********/
    $('#ads_add').on('click', function () {
        //每次点击的时候获取所有的楼层
        var data = {};
        data.pageNo = 1;
        data.pageSize = 999;
        data.bannelType = bannelPage_louceng;
        $.ajax({
            type: 'get',
            dataType: 'json',
            url: UrlbannelPage,
            data: data,
            success: function (res) {
                var data = res.data;
                var content = "";
                for (var i in data) {
                    content += '<option value="'+data[i].title+'">' + data[i].title + '</option>\n';
                }
                $("#image_floor").append(content);
            }
        });


        layer.open({
            type: 1,
            title: '添加品牌',
            maxmin: true,
            shadeClose: false, //点击遮罩关闭层
            area: ['800px', ''],
            content: $('#add_ads_style'),
            btn: ['提交', '取消'],
            yes: function (index, layero) {
                var num = 0;
                var str = "";
                $(".add_adverts input[type$='text']").each(function (n) {
                    if ($(this).val() == "") {
                        layer.alert(str += "" + $(this).attr("name") + "不能为空！\r\n", {
                            title: '提示框',
                            icon: 0,
                        });
                        num++;
                        return false;
                    }
                });
                if (num > 0) {
                    return false;
                } else {
                    var append = {};
                    append.louceng = $("#image_floor").val();
                    append.menpaihao = $("#image_number").val();
                    append.cname = $("#image_cname").val();
                    append.ename = $("#image_ename").val();
                    append.phone = $("#image_phone").val();
                    // append.shopType = $("#image_type").val();
                    append.content = $("#image_content").val();
                    append.logo = $("#logoimagepath").val();
                    append.image = $("#imagepath").val();
                    append.brand_type  = selectValue;
                    append.brand_color  = colorValue;
                    var data = {};
                    data.bannel_type = bannelType;
                    data.image_type = 2;
                    data.title = $("#image_floor").val();
                    data.content = $("#image_content").val();
                    data.image_url_str = "";
                    data.append = JSON.stringify(append);
                    data.token = localStorage.token;
                    $.ajax({
                        type: 'get',
                        dataType: 'json',
                        url: UrlbannelAdd,
                        data: data,
                        success: function (res) {
                            if (res.code != 200) {
                                layer.msg(res.message, {icon: 6, time: 1000});
                            }else{
                                layer.alert('添加成功！', {
                                    title: '提示框',
                                    icon: 1,
                                });
                                layer.close(index);
                                location.reload();
                            }
                        }
                    });
                }
            }
        });
    })
</script>
